package com.atguigu.gmall.list.client;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.list.client.impl.ListDegradeFeignClient;
import com.atguigu.gmall.model.list.SearchParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(value = "service-list",fallback = ListDegradeFeignClient.class)
public interface ListFeignClient {
    /**
     * /api/list/inner/upperGoods/{skuId}
     * 商品搜索之上架
     * 就是从数据库中读取然后存储到es中
     * Get
     * @param skuId
     * @return
     */
    @GetMapping("/api/list/inner/upperGoods/{skuId}")
    @ApiOperation("商品搜索之上架")
    public Result upperGoods(@PathVariable Long skuId);

    /**
     * /api/list/inner/lowerGoods/{skuId}
     * 商品搜索之下架
     * 删除es中的数据
     * @param skuId
     * @return
     */
    @GetMapping("/api/list/inner/lowerGoods/{skuId}")
    @ApiOperation("商品搜索之下架")
    public Result lowerGoods(@PathVariable Long skuId);

    /**
     * /api/list/inner/incrHotScore/{skuId}
     * 更新商品的热度排名
     * Get
     * @param skuId
     * @return
     */
    @GetMapping("/inner/incrHotScore/{skuId}")
    @ApiOperation("更新商品的热度排名")
    public Result incrHotScore(@PathVariable Long skuId);

    /**
     * api/list
     * 商品搜索
     * POST
     * @return
     */
    @PostMapping("/api/list")
    @ApiOperation("商品搜索")
    public Result list(@RequestBody SearchParam searchParam);
}
